import { FC } from "react";
import { QuestionRadioDefaultProps, QuestionRadioPropsType } from "./interface";
import { Radio, Space, Typography } from "antd";

const { Paragraph } = Typography;

const Component: FC<QuestionRadioPropsType> = (props) => {
  const { title, options, isVertical, value } = {
    ...QuestionRadioDefaultProps,
    ...props,
  };

  return (
    <>
      <Paragraph strong>{title}</Paragraph>
      <Radio.Group value={value}>
        <Space direction={isVertical ? "vertical" : "horizontal"}>
          {options?.map((option) => (
            <Radio key={option.value} value={option.value}>
              {option.label}
            </Radio>
          ))}
        </Space>
      </Radio.Group>
    </>
  );
};

export default Component;
